	function addMaterial(){
		var appid = $("#appid").val();
		window.location.href = rootPath+"/material/toAddNewsPage.mge?appid="+appid;
	}
	function deleteMaterial(materialId){
		//alert("delete material's id is "+materialId);
		var url = rootPath+"/material/delete.mge?id="+materialId;
		$.ajax({
			contentType : "application/x-www-form-urlencoded; charset=UTF-8", // ajax编码转换
			cache : false, // 缓存设置
			type : "DELETE", // 请求方式
			url : url, // 请求的URL
			data : "", // 请求时发送的Http参数
			dataType : "json",// 返回的数据类型，默认为json
			success : function(data){
				if(data.state == '200'){
					location.reload();
				}else{
					//alert(data.msg);
					showToast(false,data.msg);
				}
			}
		});
	}
	
	function editMaterial(id){
		window.location.href = rootPath+"/material/get.mge?id="+id;
	}
	
	function goToManagePage(appid){
		location.href = rootPath+'/material/manage.mge?appid=' + appid + '&materialType=news';
	}
	
	$(document).ready(function(){
		 $(".item_img").each(function(i){
			var imgWidth = $(this).width();
			var imgHeight = $(this).height();
			if(imgWidth > imgHeight){
				$(this).attr("width","100%");
			}else{
				$(this).attr("height","100%");
			}
		});
	});